package aliyun.cx.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import aliyun.cx.admin.entity.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {
    
    /**
     * 根据用户ID查询角色名称列表
     */
    @Select("SELECT r.name FROM role r " +
            "INNER JOIN user_roles ur ON r.id = ur.role_id " +
            "WHERE ur.user_id = #{userId}")
    List<String> getRoleNamesByUserId(Long userId);
}
